<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height + 'rem' }">
    <div
      @contextmenu.stop="emit('onContextMenuChild', $event, index)"
      v-for="(item, index) in props.info.showpieceList"
      :key="index"
      class="item-parent"
    >
      <div class="exhibits-item">
        <div class="cover-box" @click="viewImg(item.moduleId, item.id)">
          <img class="cover" :src="getLinkUrl(item.coverUrl + '?imageView2/w/600/h/600/format/webp')" alt="" />
          <img v-if="route.meta.loopType" class="flower-btn" :src="publicUrls + 'free/style11/flower.webp'" />
        </div>
        <p>{{ item.name }}</p>
      </div>
      <img
        class="boardleft"
        v-if="props.info.showpieceList?.length > 1 && index !== props.info.showpieceList?.length - 1"
        :src="publicUrls + 'free/style11/stand4right.webp'"
        alt=""
      />
    </div>
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'free11Style4',
});
</script>

<script setup lang="ts">
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';
// import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick, defineComponent } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { getLinkUrl } from '@/utils/request/upload';
import { useRoute } from 'vue-router';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const route = useRoute();
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});

const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
// watch(
//   () => props.info.width,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );
// watch(
//   () => props.info.height,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );

//
</script>

<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 0 !important;
}

.active {
  :deep(.flot-menu) {
    display: flex;
  }
}
:deep(.active) {
  z-index: 999;
}
:deep(.vdr-handle) {
  z-index: 66;
}
.boardleft {
  width: 88px;
  height: 606px;
  object-fit: cover;
  position: relative;
  margin-left: -6px;
  margin-top: 2px;
}
.item-parent {
  width: auto;
  height: 638px;
  display: flex;
  align-items: start;
  justify-content: start;
  margin-left: -2px;
  position: relative;
  &::after {
    content: '';
    position: absolute;
    left: 25px;
    bottom: -10px;
    width: 425px;
    height: 138px;
    z-index: -1;
    background: url('https://static.jiyi.show/free/style11/exhibitionStandShadow.png') no-repeat center/100% 100%;
  }
  .exhibits-item {
    width: 312px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: start;
    align-items: center;
    background: url('https://static.jiyi.show/free/style11/exhibitionStandStyle4Bg.png') no-repeat center/100% 100%;
    position: relative;
    flex-shrink: 0;
    padding-right: 12px;
    .cover-box {
      width: 240px;
      height: 306px;
      position: relative;
      margin-top: 155px;
      .cover {
        width: 100%;
        height: 100%;
        object-fit: contain;
      }
      .flower-btn {
        width: 50px;
        height: 50px;
        object-fit: cover;
        position: absolute;
        top: 40%;
        left: 50%;
        transform: translate(-50%, -40%);
        animation: flower 2s linear infinite;
        @keyframes flower {
          0% {
            opacity: 0;
          }
          40% {
            opacity: 100%;
          }
          60% {
            opacity: 100%;
          }
          100% {
            opacity: 0;
          }
        }
      }
      .bg {
        position: absolute;
        top: -1px;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
      }
    }
    ::v-deep p {
      max-width: 182px;
      font-family: SourceHanSerifCN-Bold;
      color: #fff;
      text-align: center;
      text-shadow: 0px 1px 1px rgba(133, 121, 104, 0.8);
      font-size: 18px;
      line-height: 32px;
      margin-top: 82px;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
  }
}
</style>
